package com.bh.order.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bh.common.utils.DateUtils;
import com.bh.order.domain.JcPrescoProduct;
import com.bh.order.mapper.JcPrescoProductMapper;
import com.bh.order.service.IJcPrescoProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 计划货品明细Service业务层处理
 *
 * @author slx
 * @date 2023-04-24
 */
@Service
public class JcPrescoProductServiceImpl extends ServiceImpl<JcPrescoProductMapper, JcPrescoProduct> implements IJcPrescoProductService {
    @Autowired
    private JcPrescoProductMapper jcPrescoProductMapper;

    /**
     * 查询计划货品明细
     *
     * @param id 计划货品明细主键
     * @return 计划货品明细
     */
    @Override
    public JcPrescoProduct selectJcPrescoProductById(Long id) {
        return jcPrescoProductMapper.selectById(id);
    }

    /**
     * 查询计划货品明细列表
     *
     * @param jcPrescoProduct 计划货品明细
     * @return 计划货品明细
     */
    @Override
    public List<JcPrescoProduct> selectJcPrescoProductList(JcPrescoProduct jcPrescoProduct) {
        return jcPrescoProductMapper.selectJcPrescoProductList(jcPrescoProduct);
    }

    /**
     * 新增计划货品明细
     *
     * @param jcPrescoProduct 计划货品明细
     * @return 结果
     */
    @Override
    public int insertJcPrescoProduct(JcPrescoProduct jcPrescoProduct) {
        jcPrescoProduct.setCreateTime(DateUtils.getNowDate());
        return jcPrescoProductMapper.insert(jcPrescoProduct);
    }

    /**
     * 修改计划货品明细
     *
     * @param jcPrescoProduct 计划货品明细
     * @return 结果
     */
    @Override
    public int updateJcPrescoProduct(JcPrescoProduct jcPrescoProduct) {
        return jcPrescoProductMapper.updateById(jcPrescoProduct);
    }

    /**
     * 批量删除计划货品明细
     *
     * @param ids 需要删除的计划货品明细主键
     * @return 结果
     */
    @Override
    public int deleteJcPrescoProductByIds(Long[] ids) {
        return jcPrescoProductMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除计划货品明细信息
     *
     * @param id 计划货品明细主键
     * @return 结果
     */
    @Override
    public int deleteJcPrescoProductById(Long id) {
        return jcPrescoProductMapper.deleteById(id);
    }
}
